import { ModuleTypes } from '@/store'

export enum ActionTypes {
    ACTION_ADD_VIEW = 'ACTION_ADD_VIEW',
    ACTION_ADD_VISITED_VIEW = 'ACTION_ADD_VISITED_VIEW',
    ACTION_DEL_VIEW = 'ACTION_DEL_VIEW',
    ACTION_DEL_OTHER_VIEW = 'ACTION_DEL_OTHER_VIEW',
    ACTION_DEL_CACHED_VIEW = 'ACTION_DEL_CACHED_VIEW',
    ACTION_OTHER_VIEWS = 'ACTION_OTHER_VIEWS',
    ACTION_DEL_ALL_VIEWS = 'ACTION_DEL_ALL_VIEWS',
    ACTION_DEL_ALL_CACHED_VIEWS = 'ACTION_DEL_ALL_CACHED_VIEWS',
    ACTION_UPDATE_VISITED_VIEW = 'ACTION_UPDATE_VISITED_VIEW',
}
const someKey = enumKeysAsString(ActionTypes);

export type ActionTypesNamespaced = `${ModuleTypes.tagsviewModule}/${typeof someKey}`


function enumKeysAsString<TEnum>(theEnum: TEnum): keyof TEnum {
    const keys = Object.keys(theEnum).filter(x =>
        (+x) + "" !== x) as (keyof TEnum)[];
    return keys[Math.floor(Math.random() * keys.length)];
}